﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace HelloDI
{
    class Program
    {
        static void Main(string[] args)
        {
            

            var typeName = ConfigurationManager.AppSettings["MessageWriter"];
            var messageWriter = Type.GetType(typeName, true);

            IMessageWriter consoleWriter = (IMessageWriter)Activator.CreateInstance(messageWriter);
            var consoleSalutation = new Salutation(consoleWriter);
            consoleSalutation.Exclaim();

            IMessageWriter writer = new SecureMessageWriter((IMessageWriter)Activator.CreateInstance(messageWriter));
            var Salutation = new Salutation(writer);
            Salutation.Exclaim();

            Console.ReadLine();
        }
    }
}
